package edu.stonybrook.cs.gars.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

import edu.stonybrook.cs.gars.shared.users.LoggedInUser;
import edu.stonybrook.cs.gars.shared.users.User;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class GARS implements EntryPoint {
	private final LoginPanel loginPanel;
	private final ApplicationTablePanel applicationTablePanel;
	private LoggedInUser loggedInUser;
	

	public GARS() 
	{
		ApplicationTable.createApplicationTableInstanceIfNull();
		
		loginPanel = new LoginPanel(this);
		applicationTablePanel = new ApplicationTablePanel(this);
	}
	
	/**
	 * This is the entry point method.
	 */
	@Override
	public void onModuleLoad() {
		RootLayoutPanel.get().add(new LoginPanel(this));
	}

	public void swapPanel(Widget removePanel, Widget addPanel) {
		RootLayoutPanel.get().remove(removePanel);
		RootLayoutPanel.get().add(addPanel);
	}

	public LoginPanel getLoginPanel() {
		return loginPanel;
	}

	public ApplicationTablePanel getApplicationTablePanel() {
		return applicationTablePanel;
	}

	public LoggedInUser getLoggedInUser() {
		return loggedInUser;
	}

	public void setLoggedInUser(LoggedInUser loggedInUser) {
		this.loggedInUser = loggedInUser;
	}



}
